#include "Cooker.h"
#include "ConvexCooker.h"
#include "ConcaveCooker.h"
#include <algorithm>
/**
* This main functions uses the command line arguments to cook a
* trianglemesh into a Convex or Concave physx object that can be
* loaded into a 3D application.
* The parameter are :
* 1. convex or concave
* 2. input file (must be an obj file)
* 3. output file (usually saved as .bin file)
*
* For example : Chef convex c:/data/docs/3D/test.obj c:/data/docs/3D/test.bin

* @author Koen Samyn
*/
int main(int argc, char *argv[])
{
	if ( argc == 4 )
	{
		
		

		string type = string(argv[1]);
		transform(type.begin(), type.end(),type.begin(), tolower );
		string inputFile = string(argv[2]);
		tstring iFile = tstring(inputFile.begin(),inputFile.end());
		string outputFile = string(argv[3]);
		tstring oFile = tstring(outputFile.begin(),outputFile.end());
		if ( type == "convex"){
			ConvexCooker * cc = new ConvexCooker(iFile,oFile);
			cc->StartCooking();
		}else if( type == "concave"){
			ConcaveCooker * cc = new ConcaveCooker(iFile,oFile);
			cc->StartCooking();
		}else{
			cout << "Type must be convex or concave !" << endl;
		}
	}else{
		cout << "Need 3 arguments : convex|concave inputFile outputFile"<<endl;
		cout << "Inputfile must be a valid obj file"<<endl;
		cout << "Outputfile can be any filetype you choose"<<endl;
	}
}